package com.nd.qa.shareplate.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.nd.qa.shareplate.IDao.ProjectTaskMapper;
import com.nd.qa.shareplate.model.ProjectTaskTemp;
import com.nd.qa.shareplate.service.ProjectTaskService;

@Service("com.nd.qa.shareplate.service.ProjectTaskService")
public class ProjectTaskServiceImpl implements ProjectTaskService{

	@Autowired
	private ProjectTaskMapper projectTaskMapper;
	
	@Override
	public void insertProjectInfo(ProjectTaskTemp projectTaskTemp) {
		projectTaskMapper.insertProjectInfo(projectTaskTemp);
	}

	@Override
	public ProjectTaskTemp queryProjectInfoById(ProjectTaskTemp projectTaskTemp) {
		return projectTaskMapper.queryProjectInfoById(projectTaskTemp);
	}

	@Override
	public ProjectTaskTemp getNextProjectInfo(Integer progressStatus) {
		
		List<ProjectTaskTemp> list = projectTaskMapper.getNextProjectInfo(progressStatus);
		if (list.size()<=0) {
			return null;
		}else{
			return list.get(0);
		}
	}

	@Override
	public void updateProjectInfo(ProjectTaskTemp projectTaskTemp) {
		projectTaskMapper.updateProjectInfo(projectTaskTemp);
	}
}
